package com.ruoyi.driver.enums;

/**
 * @author lipengze
 * @version 1.0
 * @description: TODO
 * @date 2024/10/21 20:08
 */
public enum IdCardSideEnum {
    FRONT("front", "身份证正面（人像面）"),
    BACK("back", "身份证反面（国徽面）");

    private final String detail;
    private final String description;

    // 构造函数
    IdCardSideEnum(String detail, String description) {
        this.detail = detail;
        this.description = description;
    }

    // 获取枚举对应的代码值
    public String getDetail() {
        return detail;
    }

    // 获取枚举对应的描述
    public String getDescription() {
        return description;
    }

    // 根据 code 获取枚举
    public static IdCardSideEnum fromDetail(String detail) {
        for (IdCardSideEnum side : IdCardSideEnum.values()) {
            if (side.getDetail().equalsIgnoreCase(detail)) {
                return side;
            }
        }
        throw new IllegalArgumentException("Invalid detail for IdCardSide: " + detail);
    }
}
